<?php

namespace app\admin\validate;

use think\Validate;

class SupplierContact extends Validate
{
    protected $rule = [
        'id' => 'require|integer',
        'supid' => 'integer',
        'cname' => 'max:50',
        'gender' => 'in:0,1',
        'birthday' => 'date',
        'phone' => 'max:20',
        'email' => 'email|max:100',
        'qq' => 'max:50',
        'wechat' => 'max:50',
        'whatsapp' => 'max:50',
        'dingtalk' => 'max:50',
        'country' => 'max:9',
        'address' => 'max:255',
        'department' => 'max:100',
        'position' => 'max:100',
        'level' => 'max:9',
        'tags' => 'max:255',
        'remark' => 'max:255',
        'create_time' => 'datetime',
        'creator' => 'integer',
        'update_time' => 'datetime',
        'updater' => 'integer',
        'is_del' => 'in:0,1'
    ];

    protected $message = [
        'id.require' => '编号必须',
        'id.integer' => '编号必须是整数',
        'supid.integer' => '供应商ID必须是整数',
        'cname.max' => '姓名不得超过50个字符',
        'gender.in' => '性别只能是0或1',
        'birthday.date' => '生日格式错误',
        'phone.max' => '手机号不得超过20个字符',
        'email.email' => '邮箱格式错误',
        'email.max' => '邮箱不得超过100个字符',
        'qq.max' => 'QQ号不得超过50个字符',
        'wechat.max' => '微信号不得超过50个字符',
        'whatsapp.max' => 'WhatsApp号不得超过50个字符',
        'dingtalk.max' => '钉钉号不得超过50个字符',
        'country.max' => '国家不得超过9个字符',
        'address.max' => '地址不得超过255个字符',
        'department.max' => '部门不得超过100个字符',
        'position.max' => '职位不得超过100个字符',
        'level.max' => '级别不得超过9个字符',
        'tags.max' => '标签不得超过255个字符',
        'remark.max' => '备注不得超过255个字符',
        'create_time.datetime' => '创建时间格式错误',
        'creator.integer' => '创建人必须是整数',
        'update_time.datetime' => '更新时间格式错误',
        'updater.integer' => '更新人必须是整数',
        'is_del.in' => '删除状态只能是0或1'
    ];

    protected $scene = [
        'search' => ['cname'],
        'delete' => ['ids' => 'require|array|checkIds'],
        'show' => ['id' => 'require'],
        'save' => ['supname', 'note']
    ];
}
